import Joi from '@hapi/joi';
import { paginateRule } from '../common';

export const indexRule = {
  query: {
    name: Joi.string().trim().allow(''),
    id: Joi.string().trim(),
    ...paginateRule,
  },
};


export const createRule = {
  body: {
    name: Joi.string()
      .trim()
      .required(),
    type: Joi.string()
      .trim()
      .required(),
    sort: Joi.number()
      .required(),
    status: Joi.number()
      .required()
  },
};

export const updateRule = {
  params: {
    id: Joi.string(),
  },
  body: createRule.body
};

export const detailRule = {
  params: {
    id: Joi.number(),
  }
};

export const destroyRule = {
  params: {
    id: Joi.string(),
  },
};

